<template>
  <div class="storehouse-framework">
    <div class="storehouse-framework__tabs">
      <label v-for="(item, index) in tabItem " :key="index">
        <input type="radio" name="btn" :checked="index === 0" @click="tabIndex = index">
        <div>{{ item }}</div>
      </label>
    </div>
    <component :is="[stockQuery, stockIn,stockCheck][tabIndex]"></component>
  </div>
</template>

<script setup>
import {ref} from 'vue';
import stockQuery from './query/index.vue';
import stockIn from './in/index.vue';
import stockCheck from './check/index.vue';
let tabIndex = ref(0);
const tabItem = ['库房查询', '产品入库', '盘点库存'];
</script>

<style lang="less" scoped>
.storehouse-framework {
  display: flex;
  flex-direction: column;
  height: 100%;

  &__tabs {
    * {
      line-height: 1;
    }

    display: flex;
    padding: 20px 30px;
    border-bottom: 10px solid #ececec;
    box-sizing: border-box;

    > label {
      margin-right: 18px;

      > input {
        display: block;
        width: 0;
        height: 0;
        opacity: 0;
      }

      > input + div {
        width: 158px;
        height: 60px;
        font-size: 24px;
        color: #666;
        background: #f8f8f8;
        box-shadow: 0 0 0 1px #e5e5e5;
        border-radius: 5px;
        text-align: center;
        line-height: 60px;
      }

      > input + div + div {
        position: absolute;
        display: none;
        width: 100%;
        left: 0;
        margin-top: 30px;
      }

      > input:checked + div {
        color: #fff;
        background: #1981f4;
        box-shadow: none;
      }
    }
  }

  &__content {
    &--input {
      display: grid;
      grid-template-columns: auto 380px auto auto;
      align-items: center;
      justify-content: start;
      margin-bottom: 28px;

      > span {
        margin-right: 19px;
        font-size: 26px;
        color: #2e323d;
      }

      > button {
        margin-left: 18px;
        width: 114px;
        height: 60px;
        font-size: 26px;
        background: #f8f8f8;
        border: 1px solid #aaaaaa;
        border-radius: 5px;
        color: #2e323d;
      }

      > div:last-child {
        display: flex;
        padding-left: 78px;

        > label {
          > input {
            display: block;
            width: 0;
            height: 0;
            opacity: 0;
          }

          > input + div {
            width: 148px;
            height: 60px;
            font-size: 26px;
            line-height: 60px;
            background: #f8f8f8;
            border: 1px solid #e5e5e5;
            border-radius: 5px 0px 0px 5px;
            text-align: center;
          }

          > input:checked + div {
            background: #e5f2ff;
            border: 1px solid #1981f4;
            color: #1981f4;
          }
        }

        > label:last-child {
          > input + div {
            border-radius: 0px 5px 5px 0px;
          }
        }
      }
    }
  }
}
</style>
